<%-- 
    Document   : detailcustomer
    Created on : Nov 24, 2011, 1:05:45 PM
    Author     : Venus
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="java.util.*,Beans.NgonNgu, Beans.LoaiKH,Beans.ThamSoHT,Models.ThamSoHT_Model, Models.LoaiKH_Model, Models.KhachHang_Model"%>
<script type="text/javascript">
    function keypress(e){
        //Hàm dùng để ngăn người dùng nhập các ký tự khác ký tự số vào TextBox
        var keypressed = null;
        if (window.event)
        {
            keypressed = window.event.keyCode; //IE
        }
        else
        {
            keypressed = e.which; //NON-IE, Standard
        }
        if (keypressed < 48 || keypressed > 57 )
        { //CharCode của 0 là 48 (Theo bảng mã ASCII)
            //CharCode của 9 là 57 (Theo bảng mã ASCII)
            if (keypressed == 8 || keypressed == 127  )
            {//Phím Delete và Phím Back
                return;
            }
            return false;
        }
    }
</script>
<%
            int langid = (Integer) session.getAttribute("langid"); // ngôn ngữ hiện tại
            String dsts = " 'customerinfo', 'address', 'msgdetailcustomer', 'birthday', 'checksubmitmsg', 'customertype', 'mark', 'nameofcustomer', 'notice', 'phonenumber', 'rightmsg', 'save' ";
            ThamSoHT[] mdsts = ThamSoHT_Model.DSThamSo(dsts, langid); // mảng chứa các tham số của trang này.

            String address = mdsts[0].getTenTS();            
            String birthday = mdsts[1].getTenTS();
            String checksubmitmsg = mdsts[2].getTenTS();
            String customerinfo = mdsts[3].getTenTS();
            String customertype = mdsts[4].getTenTS();
            String mark = mdsts[5].getTenTS();
            String msgdetailcustomer = mdsts[6].getTenTS();
            String nameofcustomer = mdsts[7].getTenTS();
            String notice = mdsts[8].getTenTS();
            String phonenumber = mdsts[9].getTenTS();
            String rightmsg = mdsts[10].getTenTS();
            String save = mdsts[11].getTenTS();            

            String msgright = notice + "/" + rightmsg;
            String msgchecksubmit = notice + "/" + checksubmitmsg;
            String msgdetail = notice + "/" + msgdetailcustomer;

            Vector vDetail = (Vector) request.getAttribute("detail");            
            String makh = (String) request.getAttribute("makh");
%>
<script type="text/javascript">
    $(function(){
        $('#datepicker1').datepicker($.datepicker.regional['vi']);
        $( "#datepicker1" ).datepicker( "option", "dateFormat","dd/mm/yy");
     });
</script>
<div class="title">
        <%=customerinfo%>        
    </div>
    <div class="content">
        <form name="createcustomer" class="customerinfo" action="">
            <%
                for(int j=0; j<vDetail.size(); j++){
                    Beans.KhachHang kh = (Beans.KhachHang) vDetail.elementAt(j);%>
                    <div style=" float: left; margin-right: 50px;">
                    <div style=" margin: 0 10px 8px;">
                        <div style=" width: 120px; float: left; "><%=customertype%></div>
                        <select name="loaikh" class="text" style=" width: 200px; height: 25px; padding-top: 2px;">
                                <option value="<%=kh.getMaLKH() %>"><%=KhachHang_Model.LayTenLoaiKH(kh.getMaLKH(), langid)%></option>
                                <%
                                    LoaiKH[] dslkh = LoaiKH_Model.DSLoaiKH(kh.getMaLKH(), langid);
                                        for (int k = 0; k < dslkh.length; k++) {%>
                                <option value="<%=dslkh[k].getMaLKH() %>"><%=dslkh[k].getTenLKH() %></option>
                                <%  }
                                %>
                         </select>
                    </div>
                    <div style=" margin: 0 10px 8px;">
                        <div style=" width: 120px; float: left; "><%=nameofcustomer%></div>
                        <input style=" width: 200px;" type="text" value="<%=kh.getHoTen() %>" class="text" name="tenkh" >
                    </div>
                    <div style=" margin: 0 10px 8px;">
                        <div style=" width: 120px; float: left; "><%=mark%></div>
                        <input style=" width: 200px;" type="text" class="text"  name="mark" value="<%=kh.getDiemTL() %>" disabled >
                    </div>
                </div>
                <div>
                    <div style=" margin: 0 10px 8px;">
                        <div style=" width: 120px; float: left;"><%=address%></div>
                        <input style=" width: 200px;" type="text" class="text" value="<%=kh.getDiaChi() %>" name="diachi">
                    </div>
                    <div style=" margin: 0 10px 8px;">
                        <div style=" width: 120px; float: left;"><%=phonenumber%></div>
                        <input style=" width: 200px;" type="text" class="text" name="sodt" value="<%=kh.getSoDT() %>" onkeypress="return keypress(event)" >
                    </div>
                    <div style=" margin: 0 10px 8px;">
                        <div style=" width: 120px; float: left;"><%=birthday%></div>
                        <input style=" width: 200px;" type="text" class="text" id="datepicker1" value="<%=kh.getNgaySN() %>" name="birthday" >
                    </div>
                </div>
            <%  }
            %>
                 <div class="cb"></div>
                 <input style=" margin-left: 337px; " class="button" type="button" alt="<%=makh %>"  id="<%=msgdetail %>" value="<%=save%>" lang="<%=msgright%>" name="<%=msgchecksubmit%>" onclick="UpdateDetailkh(this.alt,  this.id, this.lang, this.name)">
        </form>
    </div>
